package com.xnf.ssmweb.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by chendx on 2021/3/26.
 */
public class DateUtils {
    //日起转时间
    public static String date2String(Date date,String part){
        SimpleDateFormat sdf = new SimpleDateFormat(part);
        String str = sdf.format(date);
        return str;
    }
    //时间转日期
    public static Date string2Date(String str,String part) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat(part);
        Date date = sdf.parse(str);
        return date;
    }
}
